/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.yonsei.iwb.smarttv.gui;

/**
 *
 * @author Joo
 */
public class VisVertex {
    private int id;
    private int matrixId;
    private String name;
    private String instanceName;
    private boolean isInstance;
    private boolean isKeyVertex;
    
    public VisVertex(int id, String name) {
        this.id = id;
        this.name = name;
        this.isInstance = false;
        this.isKeyVertex = false;
        this.matrixId = Integer.MAX_VALUE;
    }
    public VisVertex(int id, String name, String instanceName) {
        this.id = id;
        this.name = name;
        this.instanceName = instanceName;
        this.isInstance = true;
        this.isKeyVertex = false;
        this.matrixId = Integer.MAX_VALUE;
    }
    public boolean isInstance() {
        return this.isInstance;
    }
    public boolean isKeyVertex() {
        return this.isKeyVertex;
    }
    public void setIsKeyVertex() {
        this.isKeyVertex = true;
    }
    public void setMatrixId(int matrixId) {
        this.matrixId = matrixId;
    }
    public int getMatrixId() {
        return this.matrixId;
    }
    public String toString() {
        if(this.isInstance){
            String[] uri1 = name.split("/");
            String lastUri1 = uri1[uri1.length-1];
            String[] uri2 = instanceName.split("/");
            String lastUri2 = uri2[uri2.length-1];
            return "<html><center>"+lastUri1 + "<br>(" + lastUri2 + ")";
//            return lastUri1 + " | (" + lastUri2 + ")";
            
        } else {
            String[] uri = name.split("/");
            String lastUri = uri[uri.length-1];
            return lastUri;
        }

    }
    
}
